package com.gary.spring;

import com.gary.spring.aspect.HelloService;
import com.gary.spring.scope.E;
import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.ConfigurableApplicationContext;

/**
 * @author peng_rui
 * @date 2022/6/27
 */
@Slf4j
@SpringBootApplication
public class ScopeMain {
    public static void main(String[] args) {
        ConfigurableApplicationContext context = SpringApplication.run(ScopeMain.class, args);

        HelloService helloService = context.getBean(HelloService.class);
        helloService.foo();

        System.out.println(helloService);

        E e = context.getBean(E.class);
        log.info("***********F1");
        log.info("{}", e.getF1().toString());
        log.info("{}", e.getF1().toString());
        log.info("{}", e.getF1().toString());
        log.info("***********F2");
        log.info("{}", e.getF2().toString());
        log.info("{}", e.getF2().toString());
        log.info("{}", e.getF2().toString());
        log.info("***********F3");
        log.info("{}", e.getF3().toString());
        log.info("{}", e.getF3().toString());
        log.info("{}", e.getF3().toString());
        log.info("***********F4");
        log.info("{}", e.getF4().toString());
        log.info("{}", e.getF4().toString());
        log.info("{}", e.getF4().toString());
        context.close();
    }
}
